<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" 
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>人物管理系统</title>
		<link th:href="@{/css/bootstrap.css}" rel="stylesheet" type="text/css" />
		<script type="text/javascript" th:src="@{/webjars/jquery/3.2.1/jquery.min.js}"></script>
		<script type="text/javascript" th:src="@{/js/bootstrap.min.js}"></script>
		<script th:inline="javascript">
			$(function(){
				alertMSG();
			})
			function alertMSG(){
			    var msg = [[${MSG}]];
			    if(msg!=null){
			    	 alert(msg);
			    }
			}
        </script>
</head>
<body>
<div class="container-fluid">
	<div class="row">
		<div class="col-sm-12">
			<form class="form-horizontal" th:action="@{/role}" th:object="${role}" method="post">  	
  				<input type="hidden" name="id" id="id" th:value="${role.id}"/>	
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">角色编码(<font color="red">*</font>):</label>
				    <div class="col-sm-6">
	   					<input class="form-control" type="text" id="rolename" name="rolename" th:value="${role.rolename}"  maxlength="15" />
				  		<span class="text-warning">说明：角色命名为YY_YS_00000X格式。</span>
			    	</div>
			    	<div class="col-sm-4" style="color:red"  th:errors="*{rolename}"></div>
		    	</div>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">角色描述(<font color="red">*</font>):</label>
				    <div class="col-sm-6">
	   					<input type="text" id="memo" name="memo" th:value="${role.memo}" class="form-control" />
			    	</div>
			    	<div class="col-sm-4" style="color:red"  th:errors="*{memo}"></div>
		    	</div>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label" style="margin-top:40px">权限:</label>
				    <div class="col-sm-6">
	           			<br/>
	           			<table class="table table-bordered">
	           				<tr>
		           				<td style="text-align:left;font-size:14px;width:100%">
				   					<input type="checkbox" name="allCheck" id="allCheck" onclick="selectCheckbox('allCheck','power')" ><label for="allCheck"> 全选</label></input>
		           				</td>
	           				</tr>
							<tr >
	           					<td style="text-align:center;font-size:14px;width:100%">
	           					<span th:if="${myCheckPowers!=null}" th:each="entity,iterStat:${powers}">  
			   						<input type="checkbox" name="power" class="power" style="width:10px;" th:id="${entity.id}" th:value="${entity.id}"
			   						    th:checked="${#lists.contains(myCheckPowers, entity.powername)}"></input>
					   		        <label th:for="${entity.powername}" th:text="${entity.memo}"></label>
					            </span> 
					            <span th:if="${myCheckPowers=null}" th:each="entity,iterStat:${powers}">  
			   						<input type="checkbox" name="power" class="power" style="width:10px;" th:id="${entity.id}" th:value="${entity.id}"
			   						    ></input>
					   		        <label th:for="${entity.powername}" th:text="${entity.memo}"></label>
					            </span> 
	           					</td>
							</tr> 
	           			</table>
	           			<br/> 
			    	</div>
		    	</div>
			  	<div class="form-group" style="text-align:center">
				    <label class="col-sm-2 control-label"></label>
				    <div class="col-sm-6">
				   		<button type="submit" class="btn btn-success  btn-sm"  style="width:80px" >确定</button> &nbsp; &nbsp;
						<button type="button" class="btn btn-default  btn-sm"  style="width:80px" onclick="history.go(-1)" >返回列表</button>
			    	</div>
		    	</div>
			</form>
		</div>
	</div>
</div>
</body>
</html>